#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>

/*
 * 计算文件的大小
 * */
static off_t get_file_size(const char *filename)
{
	struct stat f_st;
	if(stat(filename, &f_st) < 0)
	{
		perror("stat()");
		exit(-1);
	}
	return f_st.st_size;
}

int main(int argc, char *argv[])
{
	if(argc < 2)
	{
		fprintf(stderr, "Usage...\n");
		exit(-1);
	}
	
	printf("%lld\n",(long long)get_file_size(argv[1]));

	exit(0);
}
